package deepbitview

/**
 * a unique worker associated in the system
 */
class Worker implements Comparable {

    static constraints = {
    }

    /**
     * associated instances
     */
    SortedSet<WorkerInstance> workerInstances

    /**
     * name of this worker
     */
    String name

    /**
     * account of shares
     */
    int shares

    /**
     * amount of stales
     */
    int stales

    /**
     * basic comparisson
     * @param o
     * @return
     */
    int compareTo(Object o) {
        if (o instanceof Worker) {
            return name.compareTo(o.name)
        }
        else {
            return this.toString().compareTo(o.toString())
        }
    }
}
